#include "string_util.h"

string_util::string_util(){

}

string_util::~string_util(){

}

void string_util::str_tok(string in, char separator, vector<string>& out){
	int last_pos = 0;
	out.clear();

	while(true){
		int cur_pos = in.find(separator, last_pos);
		if (cur_pos == -1){
			cur_pos = in.size();
		}

		if (cur_pos != last_pos){
			string cur_str = in.substr(last_pos, cur_pos-last_pos);
			out.push_back(cur_str);
		}

		if (cur_pos >= in.size()){
			break;
		}

		last_pos = cur_pos+1;
	}
}
